// pages/store/storedetail.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    liked: false ,
    showDetail:false,
    count:1,
    shopCart: false,
    inputShow:false,
    cartCount:1,
    checked:false
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    wx.setNavigationBarTitle({
      title: '特价清仓秋季美衣' //页面标题为路由参数
    })
    wx.setNavigationBarColor({
      frontColor: '#000',
      backgroundColor: '#FFB6C1'
    })
  },
  // 跳转个人主页
  toPersonal: function () {
    wx.navigateTo({
      url: '/pages/myzone/mypage',
    })
  },
  // 跳转商品详情
  toGoodsDetail:function(){
    wx.navigateTo({
      url: '/pages/goods/goodsdetail',
    })
  },
  // 跳转商品详情
  toGoodsDetail:function(){
    wx.navigateTo({
      url: '/pages/goods/goodsdetail',
    })
  },
  // 点击店铺
  checkStore:function(e){
    var that = this;
    if(that.data.checked){
      that.setData({
        checked: false
      })
    }else{
      that.setData({
        checked: true
      })
    }
    
  },
  // 展示输入区域
  showInput:function(){
    var that = this;
    that.setData({
      inputShow:true
    })
  },
  // 发送文字
  submitInput:function(){
    var that = this;
    that.setData({
      inputShow:false
    })
  },
  // 数量减少
  minus:function(){
    var that = this;
    if(that.data.count != 1){
      var count = that.data.count -1;
      that.setData({
        count:count
      })
    }
  },
  // 购物车数量编辑
  minusCartCount: function () {
    var that = this;
    if (that.data.cartCount != 1) {
      var cartCount = that.data.cartCount - 1;
      that.setData({
        cartCount: cartCount
      })
    }
  },
  subCartCount: function () {
    var that = this;
    var cartCount = that.data.cartCount + 1;
    that.setData({
      cartCount: cartCount
    })
  },
  // 数量增加
  sub:function(){
    var that = this;
    var count = that.data.count +1;
    that.setData({
      count: count
    })
  },
  // 关闭购物车
  closeCart:function(){
    var that = this;
    that.setData({
      shopCart: false
    })
  },
  // 购物车列表展示
  shopCart:function(){
    var that = this;
    that.setData({
      shopCart:true
    })
  },
  closeDetail:function(){
    var that = this;
    that.setData({
      showDetail:false
    })
  },
  // 点击商品
  clickGoods:function(e){
    var that =  this;
    that.setData({
      showDetail:true
    })
  },
  // 点击关注
  clicklike:function(e){
    var that = this;
    console.log("1212")
    if(that.data.liked){
      that.setData({
        liked: false
      })
    }else{
      that.setData({
        liked: true
      })
    }
    
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})